//
//  WMEOneTableViewCell.m
//  WMEMusic
//
//  Created by 恩叔 on 16/4/16.
//  Copyright © 2016年 enshu. All rights reserved.
//

#import "WMEOneTableViewCell.h"

@interface WMEOneTableViewCell ()
@property (nonatomic, strong)UIImageView *pic;
@property (nonatomic, strong)UILabel *oneLabel;
@property (nonatomic, strong)UILabel *twoLabel;
@property (nonatomic, strong)UILabel *threeLabel;
@property (nonatomic, strong)UIImageView *oneImg;
@property (nonatomic, strong)UIImageView *twoImg;
@property (nonatomic, strong)UIImageView *threeImg;
@end
@implementation WMEOneTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.pic = [[UIImageView alloc] init];
        _pic.backgroundColor = [UIColor lightGrayColor];
        [self.contentView addSubview:_pic];
        
        self.oneImg = [[UIImageView alloc] init];
//        _oneImg.backgroundColor = [UIColor lightGrayColor];
        _oneImg.image = [UIImage imageNamed:@"1icon"];
        [self.contentView addSubview:_oneImg];
        
        self.twoImg = [[UIImageView alloc] init];
//        _twoImg.backgroundColor = [UIColor lightGrayColor];
        _twoImg.image = [UIImage imageNamed:@"2icon"];
        [self.contentView addSubview:_twoImg];
        
        self.threeImg = [[UIImageView alloc] init];
//        _threeImg.backgroundColor = [UIColor lightGrayColor];
        _threeImg.image = [UIImage imageNamed:@"3icon"];
        [self.contentView addSubview:_threeImg];
        
        self.oneLabel = [[UILabel alloc] init];
//        self.oneLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_oneLabel];
        
        self.twoLabel = [[UILabel alloc] init];
//        self.twoLabel.backgroundColor = [UIColor orangeColor];
        [self.contentView addSubview:_twoLabel];
        
        self.threeLabel  = [[UILabel alloc] init];
//        self.threeLabel.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:_threeLabel];
        
    }
    return self;
}
-(void)setModel:(WMEFirstPageModel *)model
{
    if (_model != model) {
        _model = model;
        [_pic sd_setImageWithURL:[NSURL URLWithString:_model.pic_s192]];
    }
}
- (void)setArray:(NSArray *)array
{
    if (_array != array) {
        _array = array;
        WMEFirstPageModel *model0 = _array[0];
        _oneLabel.text = model0.title;
        WMEFirstPageModel *model1 = _array[1];
        _twoLabel.text = model1.title;
        WMEFirstPageModel *model2 = _array[2];
        _threeLabel.text = model2.title;
    }
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    WS(ws);
    [_pic mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(ws.mas_left).with.offset(10);
        make.top.equalTo(ws.mas_top).with.offset(10);
        make.height.equalTo(@80);
        make.width.equalTo(@80);
    }];
    
    [_oneImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_pic.mas_right).with.offset(10);
        make.top.equalTo(ws.mas_top).with.offset(20);
        make.width.equalTo(@15);
        make.height.equalTo(@15);
    }];
    
    [_twoImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_pic.mas_right).with.offset(10);
        make.top.equalTo(_oneImg.mas_bottom).with.offset(5);
        make.width.equalTo(@15);
        make.height.equalTo(@15);
    }];
    
    [_threeImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_pic.mas_right).with.offset(10);
        make.top.equalTo(_twoImg.mas_bottom).with.offset(5);
        make.width.equalTo(@15);
        make.height.equalTo(@15);
    }];
    
    [_oneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_oneImg.mas_right).with.offset(5);
        make.top.equalTo(ws.mas_top).with.offset(20);
        make.right.equalTo(ws.mas_right).with.offset(-10);
        make.height.equalTo(@15);
    }];
    
    [_twoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_oneImg.mas_right).with.offset(5);
        make.top.equalTo(_oneLabel.mas_bottom).with.offset(5);
        make.right.equalTo(ws.mas_right).with.offset(-10);
        make.height.equalTo(@15);
    }];
    
    [_threeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_oneImg.mas_right).with.offset(5);
        make.top.equalTo(_twoLabel.mas_bottom).with.offset(5);
        make.right.equalTo(ws.mas_right).with.offset(-10);
        make.height.equalTo(@15);
    }];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
